package com.service;

import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import com.dao.BookMapper;
import com.entity.Book;

@Service //标识这是一个业务类
public class BookService {

    @Autowired //用@Autowired将BookMapper的接口对象注入到spring中
    private BookMapper bookMapper;
    @Autowired
    private SqlSession sqlSession;

    public List<Book> getBooks(){
        return bookMapper.getBooks();
    }

    public void insertBook(Book book) {
        bookMapper.insertBook(book);
    }

    public void deleteBookById(Integer id) {
        bookMapper.deleteBookById(id);
    }

    public void updateBook(Book book) {
        bookMapper.updateBook(book);
    }

    public Book findById(Integer id) {
        return bookMapper.findById(id);
    }
}